<template>
  <div>
    <FilterTable
      ref="table"
      :fetchapi="fetchApi"
      :columns="columns"
      :params="fetchParams"
      :datakey="'rows'"
      :isSelectColumn="false"
      :isColumnFilter="false"
      :isToperInfo="false"
      :onColumnsChange="columns => (this.columns = columns)"
    ></FilterTable>
  </div>
</template>
<script>
import { mapState } from 'vuex';
import { dictionary } from '@/utils/dictMixin';
import { getRemindHistorys } from '@/api/customerRepair/customerCare/vehicleRemind';

export default {
  mixins: [dictionary],
  props: {
    vin: String,
    ownerNo: String
  },
  data() {
    this.BaseTable = null;
    return {
      fetchApi: getRemindHistorys,
      fetchParams: { xhrAbort: false, vin: this.vin, ownerNo: this.ownerNo },
      columns: this.createTableColumns()
    };
  },
  mounted() {
    this.BaseTable = this.$refs.table.$refs.pageTable;
  },
  methods: {
    createTableColumns() {
      return [
        {
          title: '序号',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '经销商',
          dataIndex: 'OWNER_CODE'
        },
        {
          title: '车牌号',
          dataIndex: 'LICENSE'
        },
        {
          title: '车主',
          dataIndex: 'OWNER_NAME'
        },
        {
          title: '品牌',
          dataIndex: 'BRAND_NAME'
        },
        {
          title: '车系',
          dataIndex: 'SERIES_NAME'
        },
        {
          title: '车型',
          dataIndex: 'MODEL_NAME'
        },
        {
          title: '车主性质',
          dataIndex: 'OWNER_PROPERTY',
          render: props => {
            return <span>{this.createDictText(props.row.OWNER_PROPERTY, '8011')}</span>;
          }
        }
      ];
    }
  }
};
</script>
